package fun.barryhome.ebean.model;


import fun.barryhome.ebean.model.finder.CustomerFinder;
import io.ebean.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@Builder
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "customer")
public class Customer extends BaseModel {

  public static final CustomerFinder find = new CustomerFinder();


  public enum Status {
    @EnumValue("N")
    NEW,
    @EnumValue("A")
    APPROVED,
    @EnumValue("S")
    SHIPPED,
    @EnumValue("C")
    COMPLETE,
    @EnumValue("F")
    FOO

  }

  @DbComment("the name")
  private String name;

  //@Encrypted
  private String phone;

  @DbComment("The date")
  private LocalDate registered;

  @DbArray
  @DbComment("the array")
  private List<UUID> uids = new ArrayList<>();

  @DbJson
  private SomeEmbedd some;

  @SoftDelete
  private boolean deleted;

  Status status;

  private Integer loginCount = 0;

  @DbMap(length = 800)
  Map<String, SomeEmbedd> map;
}
